<!DOCTYPE html>
<html>
<head>
    {include file="../application/common/header.html" /}
</head>

<body>
    <table id="exam_chart_clazzdg">
    </table>
    <div id="exam_chart_clazztb">
        <form id="exam_chart_clazzForm" class="m5">
            年级号：
            <select class="easyui-combobox" id="grade" name="grade" data-options="width:120,panelHeight:'auto',value:'请选择', editable:false,url:'/examScore/exam_chart_clazz/gradeList'"></select>
            学科:
            <select id="subject" name="subject" class="easyui-combobox" data-options="width:80,panelHeight:'auto',url:'/compent/Util/subjectList'"></select>
            <a class="easyui-linkbutton l-btn l-btn-small" data-options="iconCls:'icon-search'" onclick="queryOk()">查询</a>
            <a class="easyui-linkbutton" href="javascript:void(0)" data-options="iconCls:'icon-save'" onclick="zoutExcel()">导出为EXCEL</a>
            <a class="easyui-linkbutton" data-options="iconCls:'icon-search'" onclick="clazzChartPic()">历次考试排名升降图</a>
        </form>
    </div>
    <script type="text/javascript">
        var url = "/examScore/exam_chart_clazz";
        var dfcf = "exam_chart_clazz";
        var objDfdg = $("#"+dfcf+"dg");
        $(function(){
            objDfdg.datagrid({
                url: url + "/pageQuery.html",
                rownumbers:true,
                striped:true,
                border:false,
                pagination:true,
                pageSize:30,
                fitColumns:true,
                fit:true,
                singleSelect: true,
                toolbar: '#exam_chart_clazztb'
            })
        })
        function clazzChartPic() {
            var grade = $('#grade').combobox('getValue');
            var subject = $('#subject').combobox('getText');
            if(grade && subject){
                window.open(url + "/scoreChart?grade="+grade+"&subject=" + subject);
            }else{
                $.messager.alert('操作提示','请选择年级号和学科。');
            }
        }
        function queryOk(){
            var grade = $('#grade').combobox('getValue');
            var subject = $('#subject').combobox('getText');
            if(grade && subject){
                $.post(url + "/getCharParam",{grade:grade,subject:subject},function(data){
                    var zdArr=[{field:'考试名称',title:'考试名称'}];   
                    var txshu=parseInt(data);
                    for(var i=0;i<txshu;i++){
                        title=(parseInt(i)+1)+"班";
                        name=(parseInt(i)+1);
                        zdArr.push({field:name,title:title})
                    }
                    $("#exam_chart_clazzdg").datagrid({columns:[zdArr]});
                    $('#exam_chart_clazzdg').datagrid('load',{grade:grade,subject:subject});
                })
            }else{
                $.messager.alert('操作提示','请选择年级号和学科。');
            }
        }
        function zoutExcel() {
            var grade = $('#grade').combobox('getValue');
            var subject = $('#subject').combobox('getText');
            if(grade && subject){
                window.location.href = url+"/exportExcel.html?grade=" + grade+"&subject="+subject;
            }else{
                $.messager.alert('操作提示','请选择年级号和学科。');
            }
        }
    </script>
</body>
</html>